﻿using Infrastructure.AggregateBase;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Infrastructure.DomainEvent
{
    public interface IEventDispatcher
    {
        //Task DispatchEventAsync<TDomainEvent>(
        //    TDomainEvent domainEvent,
        //    CancellationToken cancellationToken = default) where TDomainEvent : IDomainEvent;

        //Task DispatchArrayAsync<TDomainEvent>(
        //    List<TDomainEvent> domainEvents,
        //    CancellationToken cancellationToken = default) where TDomainEvent : IDomainEvent;

        Task DispatchAsync<TEntity>(
            TEntity entity,
            CancellationToken cancellationToken = default) where TEntity : EntityEntry;
        Task DispatchEntitysAsync<TEntity>(
            List<TEntity> aggregateRoots,
            CancellationToken cancellationToken = default) where TEntity : EntityEntry;

        Task SendApiEvent(DomainEventBase domainEventBase, CancellationToken cancellationToken = default);
    }
}
